package cn.genmer.test.security.designpatterns.singleton;

/**
 * @program: concurrency_practice
 * @description: 饿汉式（静态代码块）- 可用
 * @author: Genmer
 * @create: 2020-10-21 01:04
 **/
public class Singleton2 {
    // 构造方法和对象都是私有的
    private  final static Singleton2 INSTANCE;

    static {
        INSTANCE = new Singleton2();
    }

    // 这方式构造方法内容
    private Singleton2(){}

    public static Singleton2 getInstance(){
        return INSTANCE;
    }
}
